package com.mmz.controller;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.mmz.dao.ProductDao;
import com.mmz.domain.Product;
import com.mmz.service.ProductService;

@RequestMapping("/product")
@Controller
public class ProductController {
	
	private ProductService productService;
	
	public ProductService getProductService() {
		return productService;
	}
    
	@Resource(name="productService")
	public void setProductService(ProductService productService) {
		this.productService = productService;
	}

	@RequestMapping("/save")
	public String saveProduct(Product product){
		System.out.println("ProductController");
		System.out.println(product);
		productService.save(product);
		return "../index.jsp";
	}
}
